{extend name="public/base" /}
{block name="pjax_container"}
<div class="hry-content-wrapper">
<section class="content-header">
    <ol class="breadcrumb">
		<li>合同管理</li>
		<li class="active">新增公司</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                <input type="hidden" name="id" value="{$data.id}" />
                <div class="nav-tabs-custom">
                    <div class="tab-content">
							<div class="form-group">
								<label class="col-sm-2 control-label">公司账号:</label>
								<div class="col-sm-7"><input class="form-control" name="account" value="{$data.mpage}" placeholder="为公司创建一个账号"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">电话:</label>
								<div class="col-sm-7"><input class="form-control" name="mobile" value="{$data.ymoney}" placeholder="公司电话"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">公司名称:</label>
								<div class="col-sm-7"><input class="form-control" name="name" value="{$data.hz_page}" placeholder="公司名称"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">统一社会信用代码:</label>
								<div class="col-sm-7"><input class="form-control" name="code" value="{$data.hz_x}" placeholder="统一社会信用代码"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">法人代表姓名:</label>
								<div class="col-sm-7"><input class="form-control" name="legalPerson" value="{$data.hz_y}" placeholder="法人代表姓名"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">法人代表身份证:</label>
								<div class="col-sm-7"><input class="form-control" name="legalPersonIdentity" value="{$data.npage}" placeholder="法人代表身份证"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">法人代表手机号:</label>
								<div class="col-sm-7"><input class="form-control" name="legalPersonMobile" value="{$data.xname}" placeholder="法人代表手机号"></div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">CA年检抽查手机:</label>
								<div class="col-sm-7"><input class="form-control" name="contactMobile" value="{$data.yname}" placeholder="CA年检抽查手机"></div>
							</div>
						</div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                            </div>
                            <div class="btn-group pull-left">
                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
</div>
<script type="text/javascript" src="__STATIC__/hry/js/spark-md5.js"></script>
<script type="text/javascript">

$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});
    
    $('.timepicker').datetimepicker({
        format: 'YYYY-MM-DD HH:mm:ss',   //YYYY-MM-DD HH:mm:ss
        locale: moment.locale('zh-cn')
    });
    
    $("#ck-jumplink").on('ifChecked', function(event){
        $("#jumplink").removeClass("hide");
    });
    $('#ck-jumplink').on('ifUnchecked', function(event){
        $("#jumplink").addClass("hide");
    });
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})

 $("#file").change(function(){
        var v = $('#file').val();
        var reader = new FileReader();
        reader.readAsDataURL(this.files[0]);
        reader.onload = function(e){
//            console.log(e.target.result);
            $('#file_base64').val(e.target.result);
        };
        calculate();
    });

 function calculate(){
        var fileReader = new FileReader(),
        blobSlice = File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice,
            file = document.getElementById("file").files[0],
            chunkSize = 2097152,
            // read in chunks of 2MB
            chunks = Math.ceil(file.size / chunkSize),
            currentChunk = 0,
            spark = new SparkMD5();

        fileReader.onload = function(e) {
            spark.appendBinary(e.target.result); // append binary string
            currentChunk++;

            if (currentChunk < chunks) {
                loadNext();
            }
            else {
                $('#file_md5').val(spark.end());
                console.log(spark.end());

            }
        };

		function loadNext() {
			var start = currentChunk * chunkSize,
				end = start + chunkSize >= file.size ? file.size : start + chunkSize;

			fileReader.readAsBinaryString(blobSlice.call(file, start, end));
		};
		loadNext();
}
</script>
{/block}